<?php
    include('./library/conn.php');

    $phone = $_REQUEST['phone'];
    $password = $_REQUEST['password'];

    $sql = "select * from users where phone = '$phone' and password = '$password'";
    $result = $mysqli->query($sql);

    $mysqli->close();
    if($result->num_rows>0){
        $row = $result->fetch_assoc(); // 获得一条数据
        setcookie('id',$row['id'],time()+3600*24,'/');
        setcookie('isLogined','true',time()+3600*24,'/');
        echo '<script>location.href="../src/html/loading.html?type=1";</script>';
    }else{
        echo "<script>location.href='../src/html/loading.html?type=2';</script>";
    }

    // echo $phone;
?>